<template>
  <!--关于我-消息-->
  <div class="about">
    <van-tabs type="card">
      <van-tab title="我的发帖">
        <nodes :search-list="list.mine"></nodes>
      </van-tab>
      <van-tab title="我参与的">
        <nodes :search-list="list.myJoin"></nodes>
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
import { getMyJoin } from "../api/api";
import nodes from "@/components/Nodes";
import { userInfo } from "@/api/api";
export default {
  data() {
    return {
      list: {
        mine: [],
        myJoin: [],
      },
    };
  },
  components: {
    nodes,
  },
  created() {
    //userId: 85
    //更新用户信息
    userInfo().then((res) => this.$store.commit("changeInfo", res.data));
    //获取与我相关
    getMyJoin().then((res) => {
      res.rows.forEach((item) => {
        if (item.userId == this.$store.state.userInfo.userId) {
          this.list.mine.unshift(item);
        } else this.list.myJoin.unshift(item);
      });
    });
  },
};
</script>

<style scoped lang="less">
/deep/.van-tabs__content {
  margin: 35px 5px 40px;
}
/deep/.van-tabs__wrap {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 5;
  .van-tabs__nav {
    margin: 0;
  }
}
</style>
